package parion.testnetwork;

import parion.testnetwork.NetWorkModel.OnNetworkDownloadListener;
import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends Activity {

		Handler mHandler = new Handler();
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		Button btn = (Button)findViewById(R.id.button1);
		btn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				NetWorkModel.getInstace().getNetworkData("url", new OnNetworkDownloadListener(){

					@Override
					public void onDownloaded() {
						// TODO Auto-generated method stub
						Toast.makeText(MainActivity.this, "Downloaded Completed", Toast.LENGTH_SHORT).show();
					}
					
				}, mHandler);
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

}
